<?php

namespace app\admin\controller\activity;

use app\common\controller\Backend;
use think\Db;

/**
 * 
 *
 * @icon fa fa-circle-o
 */
class Examine extends Backend
{
    
    /**
     * Seckill模型对象
     * @var \app\admin\model\activity\Examine
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\admin\model\activity\Seckill;
        $this->view->assign("statusList", $this->model->getStatusList());
        $this->view->assign("typeList", $this->model->getTypeList());
    }
    /**
     * 查看 
     */
    public function index(){
            $data = input('data');
            $obj=json_decode($data,TRUE);
            foreach ($obj as $key => $value) {
                $seckill_regulate = Db::name('seckill_regulate')->insert($obj[$key]);
            } 
            if($seckill_regulate){
                $arr = [
                   'state'     => 3,
                   'seckill_regulate'  =>$seckill_regulate,
                   'obj'               =>$obj,
                   'message'   => "添加成功！"
                ];
            }else{
                $arr = [
                   'state'     => 4,
                   'seckill_regulate'  =>$seckill_regulate,
                   'obj'               =>$obj,
                   'message'  => "添加失败！"
                ];
            }
            return json($arr);  
            

    }
   
    
}
